<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
	
	<script src="${ctx}/js/controllers/mall/couponinfo/CouponApplyController.js" type="text/javascript"></script>
	<style type="text/css">
		em{
		    border-right: 1px solid #565252;
		    margin-right: 3px;
		}
	</style>
          <section>
              <div style="height:40px;line-height: 40px;">
                    <div class="forword_area"></div>
					<div class="location">当前位置：${sessionScope.currcent_position}</div>

              </div>
              <hr>
              <section>
                <!--begin 搜索栏 -->
                  <div class="panel">
	                  <div style="float:left;height: 28px;">
	                    <input id="userAccount" type="text" maxlength="20" value="${(not empty userAccount)? userAccount : ''  }" class="input-sm" placeholder="发布人账号">
	                    </div>
	                   <div class="btn-group">
		                       <select class="dropdown-menu" id="cellid" >
			                      <option value="" <c:if test="${cellId == null }">selected="selected"</c:if>>&nbsp;&nbsp;&nbsp;小区名</option> 
			                      <c:forEach items="${cellinfos}" var="item" varStatus="cStatus">
										<option value="${item.id}"  <c:if test="${item.id == cellId}">selected="selected"</c:if>>&nbsp;&nbsp;&nbsp;${item.cellName}</option>
								  </c:forEach>
		                       </select>
		                 </div>
		                 <div class="btn-group">
		                       <select class="dropdown-menu" id="shopid" >
			                      <option value="" <c:if test="${shopid == null }">selected="selected"</c:if>>&nbsp;&nbsp;&nbsp;店铺名</option> 
			                      <c:forEach items="${shopinfos}" var="item" varStatus="cStatus">
										<option value="${item.id}"  <c:if test="${item.id == shopid}">selected="selected"</c:if>>&nbsp;&nbsp;&nbsp;${item.name}</option>
								  </c:forEach>
		                       </select>
		                 </div> 
	                    <div class="btn-group">
							<select class="dropdown-menu" id="pSize">
								<c:forEach items="${pageSizes }" var="item">
									<option value="${item.value }"
										<c:if test="${pSize == item.value }">selected</c:if>>&nbsp;&nbsp;&nbsp;${item.label }</option>
								</c:forEach>
							</select>
						</div>
			             <div class="form-control">
			               <div id="social-buttons" style="margin-bottom: 0px;">
			                 <div class="search" onclick="getCouponInfoList();" ><img src="${ctx }/images/table/search_second.png"></div>
			                 <div class="delete"  style="float:left;" onclick="deleteByIds();"><img src="${ctx }/images/table/del_second.png"></div>
			               </div>
			             </div>
                </div><!--end 搜索栏 -->

                <!--begin table表格 -->
                <div>
                <table class="table">
                    <thead>
                      <tr>
                      <th width="3%">
                             <%-- <img src="${ctx }/images/tables/tubiao.png" style="left:-5px"> --%>
                             <span>
                             <img id="all" onclick="selectAll(this)" src="${ctx }/images/tables/wugou.png" style="margin-bottom: 1px;">
                             </span>
                        </th>
                        <th width="4%">序号</th>
                        <th width="10%">小区名</th>
                        <th width="10%">店铺名</th>
                        <th width="10%">发布账号</th>
                        <th width="10%">发布账号类型</th>
                        <th width="10%">状态</th>
                        <th width="10%">创建时间</th>
                        <th width="10%">操作</th>
                      </tr>
                    </thead>
                    <tbody id="tableTbody">
                      	<c:forEach items="${couponInfo.list }" var="couponInfo" varStatus="couponInfoStatus">
	                      <tr onmouseover="mouseoverOne(this)" onmouseout="mouseoutOne(this)">
	                      <td>
	                      	<img id="user${couponInfo.id}" name="couponApplyChecked" class="${couponInfo.id}" 
	                      	onclick="selectOne('${couponInfo.id}',this)" src="${ctx}/images/tables/wugou.png">
	                      	</td>
	                        <td>${couponInfoStatus.index + 1 }</td>
	                         <td>${couponInfo.cellName}</td>
	                          <td>${couponInfo.shopName}</td>
	                        <td>${couponInfo.userAccount}</td>
	                        <td>
	                        <c:choose>
	                        <c:when test="${couponInfo.userAccountType == 1}">平台</c:when>
	                        <c:when test="${couponInfo.userAccountType == 2}">商户</c:when>
	                        </c:choose>
	                        </td>
	                        <td ><c:choose>
	                        <c:when test="${couponInfo.state == 1}">审核通过</c:when>
	                        <c:when test="${couponInfo.state == 2}">正常</c:when>
	                        <c:when test="${couponInfo.state == 3 || couponInfo.state == 5}">禁用</c:when>
	                        <c:when test="${couponInfo.state == 4}">审核未通过</c:when>
	                        <c:otherwise> </c:otherwise>
	                        </c:choose></td>
	                        <td><fmt:formatDate value="${couponInfo.createTime}" type="date" pattern="yyyy-MM-dd HH:mm:ss"/></td>
	                        <td>
	                          <c:if test="${couponInfo.state == 1}">
	                          	<a onclick="approved('${couponInfo.id}','${couponInfo.state}')">拒绝</a>
	                          </c:if>
	                           <c:if test="${couponInfo.state == 2}">
	              	            <a onclick="approved('${couponInfo.id}','${couponInfo.state}')">禁用</a>
	                          </c:if>
	                          <c:if test="${couponInfo.state == 3 || couponInfo.state == 5}">
	                          	<a onclick="approved('${couponInfo.id}','${couponInfo.state}')">启用</a>
	                          </c:if>
	                          <c:if test="${couponInfo.state == 4}">
	                          	<a onclick="approved('${couponInfo.id}','${couponInfo.state}')">通过</a>
	                          </c:if> 
	                        </td>
	                      </tr>
                      	</c:forEach>
                    </tbody>         
                                      
                    <tfoot>
		            	<tr>
			               <td colspan="9">
			                  <div>
			                    <div style="float:left;">
			                      <span class="total">合计 ${couponInfo.total} 条数据</span>               
			                    </div>
			                    <div style="float:right;  margin-right: 10px;margin-top: 29px"> 
				                  <div style="float:left;">                 
				                      <ul class="footer_ul">
				                      	<c:if test="${couponInfo.hasPreviousPage }">
				                        <li onclick="gotoPage(${currentPage-1 });"><a class="leftRight">&lt;&lt;</a></li>
				                      	</c:if>
				                        <c:forEach items="${couponInfo.navigatepageNums }" var="page">
				                        <li onclick="gotoPage(${page });" class="<c:if test="${currentPage == page }">active</c:if>" style="border: 1px solid #9A9A9A;">
				                             <a>${page}</a>
				                        </li>
				                        </c:forEach>
				                        <c:if test="${couponInfo.hasNextPage }">
				                        <li><a onclick="gotoPage(${currentPage+1});" class="leftRight">&gt;&gt;</a></li>
				                      	</c:if>
				                      </ul>
			                     </div>
		                   		<div style="float:left;  height: 30px;">
									<span style="color: #9A9A9A;">跳转到</span> 
									<input class="inputclass" id="pageNo" onkeydown="if(event.keyCode==13){event.keyCode=0;return false;}" type="text" value="${currentPage }" style="width:26px;height:28px"onkeyup = "checInputNum(this)">
									<span style="color: #9A9A9A;">页</span> 
									<span class="buttonclass" id="J_JumpTo" onclick="gotoCouponInfoPage(null);"><a>GO</a></span>
								</div>
			                 </div>
			                 </div>
							</td>
						</tr>
					</tfoot>
                  </table>
                  
                </div>
                <%@include file="/views/common/footer.jsp"%>
              </section>
            </section>
		<script type="text/javascript">
		var ctx = '${ctx}';
		setCtx(ctx);
		
		//实现选中取消切换图片
		$("tbody td>img").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    //$(this).parents("tr").children().each(function(){
			   // $(this).css("background","#D3F0F1");
		   //});    
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    //$(this).parents("tr").children().each(function(){
			    //$(this).css("background","");
		   //});
		    });
		    
		//实现全选切换所有选项图标
		$("#all").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/honggou.png");  
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/wugou.png");  
		    });
	</script>
	
	<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
	<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
